package com.clusterswisdom.horn.api.ioc;


public class HornResponse {
	
	/**
	 * 天猫接口调用失败
	 */
	public static final String CODE_SUCCESS = "200";
	
	/**
	 * JST执行失败
	 */
	public static final String CODE_ERROR_INVOKE = "500";
	
	/**
	 * 输入参数错误
	 */
	public static final String CODE_ERROR_PARAM = "400";
	
	/**
	 * 天猫接口调用失败
	 */
	public static final String CODE_ERROR_API = "600";
	
	private String code;
	
	private String message;
	
	private Object data;
	
	public HornResponse(boolean success, String message) {
		this(success ? CODE_SUCCESS : CODE_ERROR_INVOKE, message, null);
	}
	
	public HornResponse(boolean success, Object data) {
		this(success ? CODE_SUCCESS : CODE_ERROR_INVOKE, "", data);
	}
	
	public HornResponse(String code, String message, Object data) {
		this.code = code;
		this.message = message;
		this.data = data;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	public boolean isSuccess() {
		return CODE_SUCCESS.equals(code);
	}
}